package com.dgut.medicalsystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.dgut.medicalsystem.entity.Notice;
import com.dgut.medicalsystem.mapper.NoticeMapper;
import com.dgut.medicalsystem.service.NoticeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 坚宝医疗
 * @since 2021-09-03
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {

    @Autowired
    NoticeMapper noticeMapper;

    @Override
    public List<Notice> getByStatus(int userid, int status) {
        return noticeMapper.getByStatus(userid,status);
    }

    @Override
    public boolean setStatus(Notice notice, int status) {
        notice.setStatus(status);
        return noticeMapper.update(notice,new LambdaUpdateWrapper<Notice>()
        .eq(Notice::getId,notice.getId()))==1;
    }


}
